@extends('layouts.head')

@section('title')
    库存记录
@endsection
@section('breadcrumb')
     <h4 >库存记录</h4>
@endsection
{{--@endsection--}}
@section('content')

    <div class="row">
        <div class="col-md-12">
            <div class="box box-info">
                   
                    <div id="workshop" class="box-body" >

                    <Tabs type="card" :animated="false">
                        <Tab-pane label="入库记录">
                         <table class="table table-bordered table-hover">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                     <th>时间</th>           
                                    <th>品名-品号</th>
                                    <th>入库数量</th>         
                                </tr>
                            </thead>
                            <tbody>
                             <tr v-for="item in inStorages"  id="table">
                                <td>@{{item['id']}}</td>
                                <td>@{{item['created_at']}}</td>
                                <td>@{{item['goodsName']}}-@{{item['goodsCode']}}</td>                                
                                <td>@{{item['count']}}@{{item['unit']}}</td>
                            </tr>
                            </tbody>
                        </table>
                        <br>
                        <Page :total=inTotal @on-change="getCurrentInPage" :page-size="20">  </Page>
                        </Tab-pane>
                        <Tab-pane label="出库记录">
                        <table class="table table-bordered table-hover">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>时间</th>  
                                    <th>品名-品号</th>
                                    <th>出库数量</th>                         
                                </tr>
                            </thead>
                            <tbody>
                             <tr v-for="item in outStorages"  id="table">
                                 <td>@{{item['id']}}</td>
                                 <td>@{{item['created_at']}}</td>
                                 <td>@{{item['goodsName']}}</td>                                
                                 <td>@{{item['count']}}@{{item['unit']}}</td>
                            </tr>
                            </tbody>
                        </table>
                        <br>
                        <Page :total=outTotal @on-change="getCurrentOutPage" :page-size="20">  </Page>
                        </Tab-pane>
                    </Tabs>

                    </div>
                </div>
            </div>
        </div>

    <script>

        var vm =new Vue({
            el:'body',
            data:{
                inStorages:[],
                outStorages:[],
                inTotal:1,
                outTotal:1,
                currentInPage:1,
                currentOutPage:1,
            },
 /***********************************************************************************************************************************************/

            created:function(){                      
                this.$http.get('/order/getIn/'+this.currentInPage).then((response) => {this.inStorages=response.data; },(response) =>{ }); 
                this.$http.get('/order/getOut/'+this.currentOutPage).then((response) => {this.outStorages=response.data; },(response) =>{ }); 

                this.$http.get('/order/getInCount').then((response) => {this.inTotal=response.data; },(response) =>{ }); 
                this.$http.get('/order/getOutCount').then((response) => {this.outTotal=response.data; },(response) =>{ }); 

                this.$Message.config({
                            top: 50,
                            duration: 3
                        });
            },

            methods:{
                getCurrentInPage:function(val){
                   this.currentInPage= val;
                   this.$http.get('/order/getIn/'+this.currentInPage).then((response) => {this.inStorages=response.data; console.log('users,success')},(response) =>{ });         
                },
                getCurrentOutPage:function(val){
                   this.currentOutPage= val;
                   this.$http.get('/order/getOut/'+this.currentOutPage).then((response) => {this.outStorages=response.data; console.log('users,success')},(response) =>{ });
                },

      }
})


    </script>

@endsection

@section('pagejs')


@endsection